
#pragma once

#if __has_include("Wire.h")
    #define _OLED__BASIC__WIRE__LIB__AVAILABLE

    #include "./backend/wire_backend.hpp"
#endif

#if __has_include("SPI.h")
    #define _OLED__BASIC__SPI__LIB__AVAILABLE

    // TODO:
    // #include "./backend/spi_backend.hpp"
#endif

#include "./driver/oled_ssd13xx_driver.hpp"
#include "oled_interface.hpp"


namespace oled_basic {

#ifdef _OLED__BASIC__WIRE__LIB__AVAILABLE

    /**
     * @brief 将SSD1306 的driver 和基于Wire 的I2C backend 组装起来，实例化后扔给应用层使用
     *
     */
    template <TwoWire &WireInstance = Wire>
    class BackendWireSSD13xx : public BackendWire<BackendWireSSD13xx<WireInstance>, WireInstance>,
                               public DriverSSD13xx<BackendWireSSD13xx<WireInstance>> {
       public:
        BackendWireSSD13xx(uint8_t address = 0x3c) :
            BackendWire<BackendWireSSD13xx<WireInstance>, WireInstance>(address) {}
    };

#endif


}  // namespace oled_basic